<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>数据魔方节点监控系统</title>
    
    <script type="text/javascript">
        var g;
        $(function ()
        {
            f_showCustomers(); 
        });
        //显示顾客
        function f_showCustomers()
        {
            g = $("#maingrid").ligerGrid({
                columns: [
                { display: '代理IP', name: 'ip', frozen: false, width : 200 },
                { display: '成功次数', name: 'successNumber', render : function(rowdata, index, value){
                	if(value == null || value == 'null' || value == ''){
                		return '0';
                	} else {
                		return value;
                	}
                }},
                { display: '失败次数', name: 'failNumber', render : function(rowdata, index, value){
                	if(value == null || value == 'null' || value == ''){
                		return '0';
                	} else {
                		return value;
                	}
                }},
                { display: '成功率', name: 'successRate', render : function(rowdata, index, value){
             		if(value >= 90){
             			return '<font color="green">' + value + '%</font>';
             		} else if(value < 70){
             			return '<font color="red">' + value + '%</font>';
             		} else {
             			return '<font color="green">' + value + '%</font>';	
             		}
			    }}
                ],
				isScroll: false, frozen:false,
				pagesizeParmName: "pageSize",  
				pageParmName: "currentPage",
				pageSizeOptions: [10, 20, 30, 40, 50, 100], 
				//data:CustomersData,
				url:"monitor/ProxyIpStatistics/obtainProxyIp.koala",
				showTitle: false,width:'90%',columnWidth:120,
				detail: { onShowDetail: f_showOrder },
				onError: function (a, b)
				{ 
				}
			});
        }
        function f_getOrdersData(CustomerID)
        {
            var data = { Rows: [] };
            for (var i = 0; i < AllOrdersData.Rows.length; i++)
            {
                if (AllOrdersData.Rows[i].CustomerID == CustomerID)
                    data.Rows.push(AllOrdersData.Rows[i]);
            }
            return data;
        }
        //显示顾客订单
        function f_showOrder(row, detailPanel,callback)
        {
            var grid = document.createElement('div'); 
            $(detailPanel).append(grid);
            $(grid).css('margin',10).ligerGrid({
                columns:[
					{ display: '渠道ID', name:  'channelId', frozen: true},
					{ display: '渠道', name: 'channelName' },
	                { display: '成功次数', name: 'successNumber', render : function(rowdata, index, value){
	                	if(value == null || value == 'null' || value == ''){
	                		return '0';
	                	} else {
	                		return value;
	                	}
	                }},
				    { display: '失败次数', name: 'failNumber', render : function(rowdata, index, value){
	                	if(value == null || value == 'null' || value == ''){
	                		return '0';
	                	} else {
	                		return value;
	                	}
	                }},
				    { display: '成功率', name: 'successRate', render : function(rowdata, index, value){
	             		if(value >= 90){
	             			return '<font color="green">' + value + '%</font>';
	             		} else if(value < 70){
	             			return '<font color="red">' + value + '%</font>';
	             		} else {
	             			return '<font color="green">' + value + '%</font>';	
	             		}
				    }}
                ], 
                isScroll: false, showToggleColBtn: false, width: '90%',
                //data: f_getOrdersData(row.CustomerID) ,
                url: 'monitor/ProxyIpStatistics/obtainProxyIpGroupByChannel.koala',
                parms: [{name : 'ip', value : row.ip}],
                pagesizeParmName: "pageSize",  
                pageParmName: "currentPage",
                pageSizeOptions: [10, 20, 30, 40, 50, 100], 
                columnWidth:120,
                showTitle: false, onAfterShowData: callback,frozen:false
            });  
        }
       
 
    </script>
</head>
<body  style="padding:10px">
 
    <div id="maingrid"></div>
 <br /> 
 <div style="display:none;">
 <!-- g data total ttt -->
</div>
</body>
</html>
